#include "commentform.h"
#include "ui_commentform.h"
#include <QDebug>

commentForm::commentForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::commentForm)
{
    ui->setupUi(this);
}

commentForm::~commentForm()
{
    delete ui;
}

void commentForm::setComment(int id, QString dishes, QString customer, QString date,
                             QString content, int selected)
{
    this->id = id;
    this->selected = selected;
    ui->customerLb->setText(customer);
    ui->dateLb->setText(date);
    if(selected == 0){
        ui->selectedLb->setVisible(false);
    };
    ui->commentEdit->append("#" + dishes + "#");
    ui->commentEdit->append(content);
}

int commentForm::getid()
{
    return id;
}

int commentForm::selectedReverse()
{
    if(ui->selectedLb->isVisible()){
        ui->selectedLb->setVisible(false);
    }else{
        ui->selectedLb->setVisible(true);
    }
    if(selected == 1){
        return 0;
    }else{
        return 1;
    }
}


